#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>

int main()
{
	int sockfd = socket(PF_INET , SOCK_DGRAM , 0);
	struct sockaddr_in addr;
	addr.sin_family = PF_INET;
	addr.sin_port = htons(1333);
	addr.sin_addr.s_addr = inet_addr("127.0.0.1");
	
//	connect(sockfd , (struct sockaddr *)&addr , sizeof(addr));
	
	socklen_t len = sizeof(addr);
	
	while(1)
	{
		char buf[100] = {};
		scanf("%s",buf);
		sendto(sockfd , buf , sizeof(buf) , 0 , (struct sockaddr *)&addr , len);
		recvfrom(sockfd , buf , sizeof(buf) , 0 , (struct sockaddr *)&addr , &len);
		printf("time = %s\n",buf);
	}
	
	close(sockfd);

}
